class AzCaches {
  constructor(iterableObject) {
    this.caches = new Set(iterableObject)
  }

  add(value) {
    return this.caches.add(value)
  }

  remove(value) {
    return this.caches.delete(value)
  }

  has(value) {
    return this.caches.has(value)
  }

  clear() {
    return this.caches.clear()
  }

  values() {
    return [...this.caches.values()]
  }

  forEach(f, thisArgs = null) {
    this.values().forEach(f, thisArgs)
  }

  [Symbol.iterator]() {
    return this.caches.values()
  }
}

export function createCaches(iterableObject) {
  return new AzCaches(iterableObject)
}
